
<template>
  <el-form
    :model="ruleForm"
    :rules="rules"
    ref="ruleForm"
    label-width="150px"
    class="demo-ruleForm"
  >
    <el-form-item label="店名" prop="name">
      <el-input v-model="ruleForm.name" style="width:200px"></el-input>
    </el-form-item>
    <el-form-item label="营业执照编号" prop="businessphone">
      <el-input v-model="ruleForm.businessphone" style="width:200px"></el-input>
    </el-form-item>
    <el-form-item label="营业执照照片" prop="businessimg">
      <el-input v-model="ruleForm.businessimg" style="width:200px"></el-input>
    </el-form-item>
    <el-form-item label="店地址" prop="address">
      <el-input v-model="ruleForm.address" style="width:200px"></el-input>
    </el-form-item>
    <el-form-item label="定位" prop="positioning">
      <el-input v-model="ruleForm.positioning" style="width:200px"></el-input>
    </el-form-item>
    <el-form-item label="所在城市" prop="city">
      <el-input v-model="ruleForm.city" style="width:200px"></el-input>
    </el-form-item>
    <el-form-item label="法人" prop="method">
      <el-input v-model="ruleForm.method" style="width:200px"></el-input>
    </el-form-item>
    <el-form-item label="联系电话" prop="phone">
      <el-input v-model="ruleForm.phone" style="width:200px"></el-input>
    </el-form-item>
    <el-form-item label="门店法人大头照" prop="headimg">
      <el-input v-model="ruleForm.headimg" style="width:200px"></el-input>
    </el-form-item>
    <el-form-item label="佣金比例" prop="commissionratio">
      <el-input v-model="ruleForm.commissionratio" style="width:200px"></el-input>
    </el-form-item>
    <el-form-item>
    <el-button type="primary" @click="submitForm('ruleForm')">立即创建</el-button>
    <el-button @click="resetForm('ruleForm')">重置</el-button>
  </el-form-item>
  </el-form>
</template>
<script>
export default {
  data() {
    return {
      ruleForm: {
        name: "",
        businessphone: "",
        businessimg: "",
        address: "",
        positioning: "",
        city: "",
        method: "",
        phone: "",
        headimg: "",
        commissionratio: ""
      },
      // rules: {
        // name: [
        //   { required: true, message: "请输入商店名称", trigger: "blur" },
        //   { min: 3, max: 8, message: "长度在 3 到 8 个字符", trigger: "blur" }
        // ],
        // businessphone: [
        //   { required: true, message: "请输入编号", trigger: "blur" },
        //    { type: 'number', message: '年龄必须为数字值'}
        // ],
        // businessimg: [
        //   { required: true, message: "请输入活动名称", trigger: "blur" },
        //   { min: 3, max: 5, message: "长度在 3 到 5 个字符", trigger: "blur" }
        // ],
        // address: [
        //   { required: true, message: "请输入活动名称", trigger: "blur" },
        //   { min: 3, max: 5, message: "长度在 3 到 5 个字符", trigger: "blur" }
        // ],
        // positioning: [
        //   { required: true, message: "请输入活动名称", trigger: "blur" },
        //   { min: 3, max: 5, message: "长度在 3 到 5 个字符", trigger: "blur" }
        // ],
        // city: [
        //   { required: true, message: "请输入活动名称", trigger: "blur" },
        //   { min: 3, max: 5, message: "长度在 3 到 5 个字符", trigger: "blur" }
        // ],
        // method: [
        //   { required: true, message: "请输入活动名称", trigger: "blur" },
        //   { min: 3, max: 5, message: "长度在 3 到 5 个字符", trigger: "blur" }
        // ],
        // phone: [
        //   { required: true, message: "请输入活动名称", trigger: "blur" },
        //   { min: 3, max: 5, message: "长度在 3 到 5 个字符", trigger: "blur" }
        // ],
        // headimg: [
        //   { required: true, message: "请输入活动名称", trigger: "blur" },
        //   { min: 3, max: 5, message: "长度在 3 到 5 个字符", trigger: "blur" }
        // ],
        // commissionratio: [
        //   { required: true, message: "请输入活动名称", trigger: "blur" },
        //   { min: 3, max: 5, message: "长度在 3 到 5 个字符", trigger: "blur" }
        // ]
      // }
    };
  },
  methods: {
   async   submitForm() {  
         await this.$store.dispatch("stores/addStore", this.$data.ruleForm)
           this.$router.push({
                name:"store"
            })
    },
    resetForm(formName) {
      this.$refs[formName].resetFields();
    }
  }
};
</script>

